<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="format.css" />
	<title></title>
</h:head>
<h:body>
	<ui:composition template="template.xhtml">
		<ui:define name="ui_right">
			<h:form id="form">
				<p:panel header="Najnowsze ogłoszenia">
					<p:growl id="msgs" showDetail="true" />

					<p:dataTable id="ogloszenia" paginator="true" rows="5"
						rowsPerPageTemplate="5, 10, 15"
						selection="#{displayAdvertisementsBean.selectedAdvertisement}"
						value="#{displayAdvertisementsBean.get10AdvertisementList()}"
						var="o" tableStyle="width:auto" rowKey="#{o.startDate}"
						emptyMessage="Nie znaleziono żadnych ogłoszeń">

						<p:column headerText="Ważne od" style="width:100px"
							sortBy="#{o.startDate}">  
				            #{o.startDate}
				        </p:column>
						<p:column headerText="Tytuł" style="width:100px"
							sortBy="#{o.title}">  
				            #{o.title}
				        </p:column>

						<p:column headerText="Treść" style="width:300px">  
				            #{o.content}
				        </p:column>

						<p:column headerText="Kategoria" style="width:100px">  
				             #{o.category.name}
				        </p:column>

						<p:column headerText="Typ" style="width:100px">  
				             #{o.type.name}
				        </p:column>

						<p:column style="width:40px">
							<h:panelGrid columns="3" styleClass="actions" cellpadding="2">

								<p:commandButton id="selectButton" title="Przejdź"
									icon="ui-icon-search" action="result" ajax="false">
									<f:setPropertyActionListener
										target="#{displayAdvertisementsBean.selectedAdvertisement}"
										value="#{o}" />
										<f:setPropertyActionListener
										target="#{displayAdvertisementsBean.images}"
										value="#{o.attachments}" />
								</p:commandButton>

							</h:panelGrid>
						</p:column>

					</p:dataTable>

				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
